package com.study.dao;

import com.study.pojo.Account;
import org.mybatis.spring.SqlSessionTemplate;

import java.util.List;

public class UserMapperImpl implements UserMapper {

    //原来我们的操作都使用sqlSession，现在我们使用SqlSessionTemplate
    private SqlSessionTemplate sqlSession;

    public void setSqlSession(SqlSessionTemplate sqlSession) {
        this.sqlSession = sqlSession;
    }

    public List<Account> getAccounts() {
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        return mapper.getAccounts();
    }
}
